interface PrintColor {
    String color();
}

enum KyoColor implements PrintColor {
    BLACK(30) {
        public String color() {
            return "黑色";
        }
    },
    RED(31) {
        public String color() {
            return "红色";
        }
    },
    GREEN(32) {
        public String color() {
            return "绿色";
        }
    },
    YELLOW(33) {
        public String color() {
            return "黄色";
        }
    },
    BLUE(34) {
        public String color() {
            return "蓝色";
        }
    };

    private int code;

    KyoColor(int code) {
        this.code = code;
    }

    public int getCode() {
        return this.code;
    }

    // public abstract String color();
}

public class EnumTest {
    static public KyoColor test(KyoColor color) {
        KyoColor c = null;
        switch (color) {
            case BLACK:
                c = KyoColor.RED;
                break;
            case RED:
                c = KyoColor.GREEN;
                break;
            case GREEN:
                c = KyoColor.YELLOW;
                break;
            case YELLOW:
                c = KyoColor.BLUE;
                break;
            case BLUE:
                c = KyoColor.BLACK;
                break;
        }
        return c;
    }

    static public void main(String [] args) {
        KyoColor c = KyoColor.RED;
        System.out.println(test(c));

        System.out.printf("====================\n");

        for (KyoColor c : KyoColor.values()) {
            System.out.println(c + ": " + c.getCode() + ", " + c.color());
        }
    }
}
